#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
typedef double db;
inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
}
const int MAXN=1510;
int n,head[MAXN],cnt,f[MAXN][2];
struct edge
{
	int v,next;
}e[MAXN*2];
void addedge(int x,int y)
{
	e[++cnt]=(edge){y,head[x]};
	head[x]=cnt;
	return;
}
void treedp(int u,int fa)
{
	f[u][1]=1;
	for(int i=head[u];i;i=e[i].next)
	{
		int v=e[i].v;
		if(v==fa)continue;
		treedp(v,u);
		f[u][0]+=f[v][1];
		f[u][1]+=min(f[v][0],f[v][1]);
	}
	return;
}
int main()
{
	n=read();
	for(int i=1;i<=n;++i)
	{
		int x=read(),m=read();
		while(m--)
		{
			int y=read();
			addedge(x,y);
			addedge(y,x);
		}
	}
	treedp(0,-1);
	printf("%d\n",min(f[0][0],f[0][1]));
	return 0;
}
